import 'package:flutter/material.dart';
import 'package:tvlives/pages/Chanel.dart';
import 'package:tvlives/pages/My.dart';
import 'package:tvlives/pages/My_Favorite.dart';
import 'package:tvlives/pages/Recommendation.dart';

class HomePage extends StatefulWidget{
  @override
  State<StatefulWidget> createState() {
    return new _HomeState();
  }
}

class _HomeState extends State<HomePage> with SingleTickerProviderStateMixin{
  int _currentIndex = 0;
  List<Widget> _listPage =[
    new RecommendPage(),
    new MyFavoritePage(),
    new ChanelPage(),
    new MyPage(),
  ];

 List<BottomNavigationBarItem> _listBar = [
   new BottomNavigationBarItem(icon: Icon(Icons.home),title: Container(child: Text("推荐"),)),
   new BottomNavigationBarItem(icon: Icon(Icons.favorite),title: Container(child: Text("收藏"),)),
   new BottomNavigationBarItem(icon: Icon(Icons.live_tv),title: Container(child: Text("频道"),)),
   new BottomNavigationBarItem(icon: Icon(Icons.person),title: Container(child: Text("我的"),)),
 ];

  @override
  void initState() {
    super.initState();
  }

  @override
  void dispose() {
    super.dispose();
  }
  @override
  Widget build(BuildContext context) {
     return  new Scaffold(
         body: IndexedStack(
           index: _currentIndex,
           children: _listPage,
         ),
        bottomNavigationBar: BottomNavigationBar(onTap:(int index){
          setState(() {
            _currentIndex  = index;
          });
        },items: _listBar,
        currentIndex: _currentIndex,
        type: BottomNavigationBarType.fixed,),
       );
  }
}